//
//  ViewController.m
//  JLCLSDK_Minus_Demo
//
//  Created by jlcl on 2024/9/24.
//

#import "ViewController.h"
#import "JLCLSplashViewController.h"
#import "JLCLInterstitialViewController.h"
#import "JLCLRewardedVideoViewController.h"
#import "JLCLNativeViewController.h"
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong)UITableView *tableView;
@property (nonatomic, strong)NSArray *dataArray;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor whiteColor]];
    
    self.navigationItem.title = @"聚量磁力Demo";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20 weight:9],NSForegroundColorAttributeName:[UIColor blackColor]}];
    // Do any additional setup after loading the view.
    self.dataArray = [[NSMutableArray alloc] init];
    self.dataArray = @[@"开屏广告(Splashad)",@"激励视频广告(RewardVideo)",@"插屏广告(Interaction)",@"信息流广告(Native)"];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kNavBarAndStatusBarHeight, kScreen_Width, kScreen_Height - kNavBarAndStatusBarHeight) style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = [UIColor whiteColor];
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
    [self.view addSubview:self.tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(UITableViewCell.class) forIndexPath:indexPath];
    cell.textLabel.text = self.dataArray[indexPath.row];
    cell.textLabel.textColor = [UIColor blackColor];
    cell.textLabel.textAlignment = NSTextAlignmentCenter;
    cell.backgroundColor = [UIColor whiteColor];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.row) {
        case 0: {
            dispatch_async(dispatch_get_main_queue(), ^{
                JLCLSplashViewController *splashVC =[[JLCLSplashViewController alloc] init];
                [self.navigationController pushViewController:splashVC animated:YES];
            });
        }
            break;
        case 1: {
            JLCLRewardedVideoViewController *rewardedVideoVC = [[JLCLRewardedVideoViewController alloc] init];
            [self.navigationController pushViewController:rewardedVideoVC animated:YES];
        }
            break;
        case 2: {
            JLCLInterstitialViewController *interstitialVC = [[JLCLInterstitialViewController alloc] init];
            [self.navigationController pushViewController:interstitialVC animated:YES];
        }
            break;
        case 3: {
            JLCLNativeViewController *navtiveVC = [[JLCLNativeViewController alloc] init];
            [self.navigationController pushViewController:navtiveVC animated:YES];
        }
            break;
        
        default:
            break;
    }
}
@end
